﻿/** 
 * Copyright / Licence
 * <p>
 * You are free:
 * <li>to Share — to copy, distribute and transmit the work
 * <li>to Remix — to adapt the work
 * </p>
 * <p>
 * Under the following conditions:
 * <li>Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
 * <li>Noncommercial — You may not use this work for commercial purposes.
 * <li>Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
 * </p>
 * <p>
 * More information can be found here:
 * <br/>
 * http://creativecommons.org/licenses/by-nc-sa/3.0/
 * </p>
 * <p>
 * Please contact Manfred Weber [manfred.weber@gmail.com] if you require a commercial licence
 * </p>
 */
 package org.dschini.ui.maps.world {

	import flash.events.*;
	import flash.display.*;
	import org.dschini.data.ui.maps.*;
	import org.dschini.data.ui.maps.world.*;
	import org.dschini.data.ui.maps.world.northamerica.*;
	import org.dschini.ui.maps.*;
	import org.dschini.ui.maps.world.*;
	import org.dschini.ui.maps.world.northamerica.*;

	public class NorthAmericaMap extends Map
	{
		public var northAmericaMapCountryLines:MovieClip;
		
		public var azoresMap:AzoresMap;
		public var alaskaMap:AlaskaMap;
		public var hawaiiMap:HawaiiMap;
		public var canadaMap:CanadaMap;
		public var greenlandMap:GreenlandMap;
		public var cubaMap:CubaMap;
		public var bahamasMap:BahamasMap;
		public var jamaicaMap:JamaicaMap;
		public var portAuPrinceMap:PortAuPrinceMap;
		public var dominicanRepublicMap:DominicanRepublicMap;
		public var puertoRicoMap:PuertoRicoMap;
		public var guadeloupeMap:GuadeloupeMap;
		public var martiniqueMap:MartiniqueMap;
		public var belizeMap:BelizeMap;
		public var guatemalaMap:GuatemalaMap;
		public var elSalvadorMap:ElSalvadorMap;
		public var hondurasMap:HondurasMap;
		public var nicaraguaMap:NicaraguaMap;
		public var costaRicaMap:CostaRicaMap;
		public var panamaMap:PanamaMap;
		public var mexicoMap:MexicoMap;
		public var usaMap:UsaMap;

		public function NorthAmericaMap():void
		{
			countries = [
					azoresMap,
					alaskaMap,
					hawaiiMap,
					canadaMap,
					greenlandMap,
					cubaMap,
					bahamasMap,
					jamaicaMap,
					portAuPrinceMap,
					dominicanRepublicMap,
					puertoRicoMap,
					guadeloupeMap,
					martiniqueMap,
					belizeMap,
					guatemalaMap,
					elSalvadorMap,
					hondurasMap,
					nicaraguaMap,
					costaRicaMap,
					panamaMap,
					mexicoMap,
					usaMap
			]
		}
		
		override public function set mouseEnabled( mouseEnabled:Boolean ):void
		{
			super.mouseEnabled = mouseEnabled;
			for(var i:int=0; i<countries.length; i++){
				Map(countries[i]).mouseEnabled = mouseEnabled;
			}
		}
		
		override public function set doubleClickEnabled( doubleClickEnabled:Boolean ):void
		{
			super.doubleClickEnabled = doubleClickEnabled;
			for(var i:int=0; i<countries.length; i++){
				Map(countries[i]).doubleClickEnabled = doubleClickEnabled;
			}
		}
		
		override public function set data( data:MapData ):void
		{
			_data = data;
			for(var i:int=0; i<countries.length; i++){
				countries[i].data = MapData(_data).countries[i];
			}
		}
		
		override public function render():void
		{
			northAmericaMapCountryLines.visible = data.countryLinesVisible ? true : false;
			if( data.countryLinesColorTransform ){
				northAmericaMapCountryLines.transform.colorTransform = data.countryLinesColorTransform;
			}
			for(var i:int=0; i<countries.length; i++){
				countries[i].render();
			}
		}
	}
}
